﻿using IService.Admin;

namespace Service.Admin
{
    public class CustomerProtocolService : BaseService<TCustomerProtocol>, ICustomerProtocolService
    {
        public CustomerProtocolService(IUnitOfWorkService unitOfWorkService) : base(unitOfWorkService)
        {
        }

        /// <summary>
        /// 添加或修改
        /// </summary>
        /// <param name="par"></param>
        /// <returns></returns>
        public async Task<RM_ApiResult> AddOrUpdate(TCustomerProtocol par)
        {
            var result = await AddOrUpdate(par, true);

            if (result > 0)
            {
                return _ResultHelper.BuildActionSuccess();
            }
            else
            {
                return _ResultHelper.BuildActionError();
            }
        }

        public async Task<RM_ApiResult> GetFirst()
        {
            var data = await Get();
            return _ResultHelper.BuildSuccess(data);
        }
    }
}